package cn.iocoder.yudao.module.test.listener.bpmPurchaseOrderDemo;



import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;
import cn.iocoder.yudao.module.test.service.BpmPurchaseOrderDemoService;
import cn.iocoder.yudao.module.test.service.BpmPurchaseOrderDemoServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author cjc
 * @Date 2024/1/12 10:46
 * @Description: 采购订单-流程结束监听器
 * @Version 1.0
 */
@Component
public class PurchaseOrderResultListener extends BpmProcessInstanceStatusEventListener {

    @Resource
    private BpmPurchaseOrderDemoService bpmPurchaseOrderDemoService;

    @Override
    protected String getProcessDefinitionKey() {
        return BpmPurchaseOrderDemoServiceImpl.PROCESS_KEY;
    }

    @Override
    protected void onEvent(BpmProcessInstanceStatusEvent event) {
        System.out.println(event);

        String businessKey = event.getBusinessKey();
        Integer status = event.getStatus();
        String id = event.getId();
        long timestamp = event.getTimestamp();
        String processDefinitionKey = event.getProcessDefinitionKey();

        System.out.println(businessKey);
        System.out.println(status);
        System.out.println(id);
        System.out.println(timestamp);
        System.out.println(processDefinitionKey);
    }
}
